package cn.genmer.test.security.model;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.io.Serializable;

@Data
@ToString
@AllArgsConstructor
@NoArgsConstructor
public class Sheep implements Serializable, Cloneable{

    private String name;
    private Integer age;

    @Override
    protected Object clone() throws CloneNotSupportedException {
        Sheep sheep = (Sheep) super.clone();
        return sheep;
    }

    public static void main(String[] args) throws CloneNotSupportedException {
        Sheep sheep1 = new Sheep("肖恩", 3);
        System.out.println(sheep1 + ":" +sheep1.hashCode());
        Object clone = sheep1.clone();
        System.out.println(clone+ ":" + clone.hashCode());
        System.out.println(sheep1 == clone);
    }
}
